#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
inline int box(int a, int b, int c, int w);
int main()
{
    int x, y, z, sum = 0, v = 0, w = 0;
    cin >> x >> y;
    if (x <= y)
        z = x;
    else
    {
        z = y;
        y = x;
        x = z;
    }
    sum = 4 * z;
    v = box(x, y, v, w);
    sum = sum + v;
    cout << sum;
}
inline int box(int a, int b, int c, int w)
{
    b = b - a;
    if (b > a)
        c = a;
    w += 4 * c;
    return box(a, b, c, w);
    if(1)
        w += b * 4 + (a - b) * (a) * 4;
    return w;  
}